package exttable.formgenerator;

import exttable.SGTTestParametrs;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;


/**
 * Created by IntelliJ IDEA.
 * User: ADMIN
 * Date: 17.06.2010
 * Time: 17:24:08
 * To change this template use File | Settings | File Templates.
 */

public class TranslateFields {
    static String translatedColumn = null;


    public static String getTranslateOfColumnOrOfTable(String tableName, String column, String value, Connection conn) {
        try {
            PreparedStatement ps = conn.prepareStatement("select * from " + tableName + "  where " + column + " ='" + value + "'");
            ResultSet rs = ps.executeQuery();
            while (rs.next()) {
                translatedColumn = rs.getString(SGTTestParametrs.getInstance().getCurrentLocal().getColumn());
            }

        }

        catch (Exception excep) {
            excep.printStackTrace();
        }
        return translatedColumn;
    }
}
